<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    request.setAttribute("basePath",basePath);
%>
<%@ include file="/resources/js/easyui/taglibs.jsp"%>
<%@ include file="/resources/js/wechat/_wechatui.jsp"%>
<%@ include file="/resources/js/easyui/_viewJS.jsp"%>
<!DOCTYPE>
<html>
<head>
    <title>场地状态</title>
</head>
<body>
<div class="loading"></div>
<!-- header -->
<header>
    <a href="javascript:history.go(-1);" class="top_fh">场地状态</a>
</header>
<!-- header end -->

<div class="page">
    <div class="homecdbj_inner">
        <div class="cdbbj_list">
            <ul>
                <li><p><span>场地编号</span><i><input type="text" name="placeNum" value="${place.placeNum}" /></i></p></li>
                <li><p><span>场地名称</span><i><input type="text" name="address" value="${place.address}" /></i></p></li>
                <li><a href="#">添加设备</a></li>
            </ul>
            <div class="tcse_button"><a href="JavaScript:;">保存</a></div>
        </div>
    </div>
</div>

<!-- footer -->
<div class="zmxq_footer home_footer">
    <a href="${basePath}wechat/operate/device/listView">设备</a>
    <a href="${basePath}wechat/operate/place/listView" class="cur">场地</a>
</div>
<!-- footer end -->

<script type="application/javascript">
    function View(){
        var that = this;

        that.events = [
            { sel : '#addSubBtn', act : 'click', func : 'addSub' }
        ];

        that.addSub = function(){
            $.ajax({
                url:'${basePath}wechat/operate/place/${place.placeid}/edit',
                type : 'POST',
                data : $("#addform").serialize(),
                error: function (response) {
                    ViewHelper.func.ajaxWechatErrorMessage(response);
                },
                success: function (ret) {
                    if(ret.result) {
                        window.location = "${basePath}wechat/operate/place/listView";
                    }else{
                        alert(ret.info);
                    }
                }
            });
        };

        EventHandler.call(that, that.events);

        return that;
    }

    var view;

    $(function(){
        inherit(View, EventHandler);
        view = new View();
    });
</script>

</body>
</html>